package com.atguigu.flume.interceptor;

import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONException;

/**
 * JSON工具类：判断字符串是否是JSON格式
 *
 * @author GengMingchi
 * @email gmc001008@163.com
 * @create 2022/7/20 9:44
 */
public class JSONUtils {
    public static boolean isJSONValidate(String log) {
        try {
            JSON.parse(log);
            return true;
        } catch (JSONException e) {
            return false;
        }
    }
}
